package indi.juzhuohan.chatroom.server;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JTabbedPane;
/**
 * 服务器主窗体
 * @author 鞠卓瀚
 *
 */
public class Serverframe extends JFrame {
	
	private static final long serialVersionUID = 8554645892609848826L;
	public static final Integer FRAME_WIDTH = 550;
	public static final Integer FRAME_HEIGHT = 500;
	public Onlineuserpanel onlineuserpanel;
	public ServerUI serverUI;
	
	public Serverframe() {
//		窗体
		this.setTitle("JJ聊天室服务器");
//		窗口大小
		setSize(FRAME_WIDTH, FRAME_HEIGHT);
//		不可放大
		setResizable(false);
//		获取屏幕宽高，居中处理
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		int width = screenSize.width;
		int height = screenSize.height;
		setLocation((width-FRAME_WIDTH)/2, (height-FRAME_HEIGHT)/2);
//		窗体关闭，程序退出
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//		选项卡
		JTabbedPane tpServer = new JTabbedPane(JTabbedPane.TOP);
		tpServer.setBackground(Color.WHITE);
		tpServer.setFont(new Font("黑体", 0, 18));
//		第一个选项卡
		serverUI = new ServerUI();
		tpServer.add("服务器管理" , serverUI.getServerUI());
//		第二个选项卡
		onlineuserpanel = new Onlineuserpanel();
		tpServer.add("在线用户" , onlineuserpanel.getUserPanel());
		add(tpServer);
		setVisible(true);
	}
}
